/*
** cmd.c for  in /home/faye_m//zappy
** 
** Made by mouhamed faye
** Login   <faye_m@epitech.net>
** 
** Started on  Mon Jun 20 20:51:43 2011 mouhamed faye
** Last update Mon Jun 20 22:56:34 2011 mouhamed faye
*/
#include <stdio.h>
#include <stdlib.h>
#include "cmd.h"

list_request	*add_request(list_request *req, char *cmd)
{
  list_request *updated_list;
  
  updated_list = malloc(sizeof(list_request));
  if(!updated_list)
    printf ("fonction add_command segfault segfault the zappy ....\n");
  updated_list->cmd = cmd;
  updated_list->delay = 100; // default : call get_cmd_delay function
  updated_list->num_client  = 1;
  updated_list->nb_req +=1;
  updated_list->next = req->next;
  
  return (updated_list);
}


void	del_command(list_request *req, char *cmd)
{
}

void	display_command(list_request *all_request)
{
  list_request *data;
  data = malloc(sizeof(list_request));
  
  if(!data)
    printf ("fonction display command segfault\n");
  while (data->next != NULL)
    {
      printf ("cmd -> %", data->cmd);
      data = data->next;
    }
}

int	main()
{
  list_request *test;
  test = malloc(sizeof(*test));
  if (!test)
    printf ("main segfault\n....");
  add_request(test, "avance");
  add_request(test, "avance");
  add_request(test, "incantation");
  add_request(test, "voir");
  // display_request(test);
}
  
  
